home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / share / hplip / ui / setupsettings.py < prev    next >
Text File  |  2008-10-13  |  4KB  |  118 lines

  1. # -*- coding: utf-8 -*-
  2. #
  3. # (c) Copyright 2001-2007 Hewlett-Packard Development Company, L.P.
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  18. #
  19. # Author: Don Welch
  20. #
  21.  
  22. from base.g import *
  23. from base.codes import *
  24.  
  25. from qt import *
  26. from setupsettings_base import SetupSettings_base
  27.  
  28. class SetupSettings(SetupSettings_base):
  29.     def __init__(self, bus, filter, search, ttl, timeout, parent=None, name=None, modal=0, fl = 0):
  30.         SetupSettings_base.__init__(self, parent, name, modal, fl)
  31.  
  32.         self.filter = filter
  33.         self.search = search
  34.         self.ttl = ttl
  35.         self.timeout = timeout
  36.  
  37.         if 'none' in filter:
  38.             self.filterButtonGroup.setButton(0)
  39.         else:
  40.             self.filterButtonGroup.setButton(1)
  41.             self.faxCheckBox.setChecked('fax' in filter)
  42.             self.scanCheckBox.setChecked('scan' in filter)
  43.             self.pcardCheckBox.setChecked('pcard' in filter)
  44.             self.copyCheckBox.setChecked('copy' in filter)
  45.  
  46.         self.searchTermLineEdit.setText(self.search)
  47.  
  48.         self.ttlSpinBox.setValue(self.ttl)
  49.         self.timeoutSpinBox.setValue(self.timeout)
  50.         
  51.         if not prop.net_build:
  52.             self.ttlSpinBox.setEnabled(False)
  53.             self.timeoutSpinBox.setEnabled(False)
  54.             self.groupBox3.setEnabled(False)
  55.             self.textLabel7.setEnabled(False)
  56.             self.textLabel8.setEnabled(False)
  57.  
  58.     def faxCheckBox_toggled(self,a0):
  59.         self.updateFilter()
  60.  
  61.     def scanCheckBox_toggled(self,a0):
  62.         self.updateFilter()
  63.  
  64.     def pcardCheckBox_toggled(self,a0):
  65.         self.updateFilter()
  66.  
  67.     def copyCheckBox_toggled(self,a0):
  68.         self.updateFilter()
  69.  
  70.     def filterButtonGroup_clicked(self, a0):
  71.         self.updateFilter(a0)
  72.  
  73.     def searchTermLineEdit_textChanged(self, a0):
  74.         self.search = unicode(a0)
  75.  
  76.     def ttlSpinBox_valueChanged(self, a0):
  77.         self.ttl = a0
  78.         log.debug(self.ttl)
  79.  
  80.     def timeoutSpinBox_valueChanged(self, a0):
  81.         self.timeout = a0
  82.         log.debug(self.timeout)
  83.  
  84.     def updateFilter(self, id=-1):
  85.         self.filter = []
  86.         
  87.         if id == 0:
  88.             return 
  89.  
  90.         else:
  91.             if self.faxCheckBox.isChecked():
  92.                 self.filter.append('fax')
  93.  
  94.             if self.scanCheckBox.isChecked():
  95.                 self.filter.append('scan')
  96.  
  97.             if self.pcardCheckBox.isChecked():
  98.                 self.filter.append('pcard')
  99.  
  100.             if self.copyCheckBox.isChecked():
  101.                 self.filter.append('copy')
  102.  
  103.             #if not filter:
  104.             #    filter.append('none')
  105.  
  106.         log.debug(self.filter)
  107.  
  108.  
  109.     def defaultsPushButton_clicked(self):
  110.         self.filterButtonGroup.setButton(0)
  111.         self.updateFilter(0)
  112.         self.searchTermLineEdit.setText('')
  113.         self.ttlSpinBox.setValue(4)
  114.         self.timeoutSpinBox.setValue(5)
  115.  
  116.     def __tr(self,s,c = None):
  117.         return qApp.translate("SetupSettings_base",s,c)
  118.